<?php

include_once($mcrp . 'functions/cache.php');

function CreateNews($Title, $Description)
{
	global $mcsql;
	$result = $mcsql->Query('INSERT INTO news(title, description) VALUES(\'' . $Title . '\', \'' . $Description . '\')');
	if($result === false)
		return false;
	return true;
}

function GetNews($Number)
{
	global $mcsql;	
	$HTML = '';
	$answer = $mcsql->Query('SELECT * FROM news ORDER BY id DESC LIMIT 0,'. $Number);
	
	while($news = mysql_fetch_array($answer))
	{
		$HTML .= '<div class="index_box_actu">';
		$HTML .= '	<h4>'.stripslashes($news['title']).'</h4>';
		$HTML .= '	<div class="mc_boxactu_content">'.stripslashes($news['description']).'</div>';
		$HTML .= '</div>';
	}	
	return $HTML;
}



function GetAllNews()
{
	global $mcsql;	
	$HTML = '';
	$answer = $mcsql->Query('SELECT * FROM news ORDER BY id DESC');
	
	while($news = mysql_fetch_array($answer))
	{
		$HTML .= '<div class="mc_boxactu">';
		$HTML .= '	<h4>'.stripslashes($news['title']).'</h4>';
		$HTML .= '	'.stripslashes($news['description']).'</p>';
		$HTML .= '</div>';
	}
	return $HTML;
}

?>